/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-05-04 09:50:21
 * @LastEditTime : 2023-07-11 08:26:06
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\FirstLevel\Api.jsx
 * @Description  :
 */
import { API_LIST } from '../../../Api/Api'
import { commonTableList, BuiltInData } from '../Common/common'
import { AddDataButton, ModDataButton, DelDataButton, FlowChartButton } from '../Common/options'

export const RiskSources = async ({ url, OptionsEvent, ClientData, Permission, actionRef }) => {
    let data = {
        pageSize: 10,
        params: { pageIndex: 1 },
        get: API_LIST()[`get${url}`],
        added: `pos${url}`,
        modify: `put${url}`,
        delete: `del${url}`,
        hideInSearch: true,
        options: [<AddDataButton OptionsEvent={OptionsEvent} type="primary" icon="add" title="新增" />],
        columns: [
            { ...commonTableList.SearchSort, selectType: 'RiskSources' },
            commonTableList.uuid,
            { ...commonTableList.organizationUuid, valueEnum: ClientData.organization },
            { ...commonTableList.tableName },
            {
                dataIndex: 'lng',
                title: '经度',
                valueType: 'input',
                rules: true,
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'lat',
                title: '纬度',
                valueType: 'input',
                rules: true,
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'mileage',
                title: '桩号',
                valueType: 'input',
                rules: true,
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'grade',
                title: '等级',
                valueType: 'select',
                valueEnum: { 重大风险: '重大风险', 较大风险: '较大风险', 一般风险: '一般风险' },
                rules: true,
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'controlMeasures',
                title: '防控措施',
                valueType: 'input',
                rules: true,
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'eventDate',
                title: '日期',
                valueType: 'Date',
                rules: true,
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'head1',
                title: '施工单位联系人',
                valueType: 'input',
                rules: true,
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'head2',
                title: '监理单位联系人',
                valueType: 'input',
                rules: true,
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'head1Phone',
                title: '施工单位联系方式',
                valueType: 'input',
                rules: true,
                hideInSearch: true,
                width: 200,
            },
            {
                dataIndex: 'head2Phone',
                title: '监理单位联系方式',
                valueType: 'input',
                rules: true,
                hideInSearch: true,
                width: 200,
            },
            commonTableList.BeginStatDate,
            commonTableList.EndStatDate,
            commonTableList.createUserName,
            commonTableList.createTime,
            commonTableList.updateUserName,
            commonTableList.updateTime,
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 160,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        <ModDataButton OptionsEvent={OptionsEvent} key="modify" title="修改" data={record} />,
                        <DelDataButton
                            OptionsEvent={OptionsEvent}
                            key="del"
                            title="删除"
                            url={url}
                            uuid={record.uuid}
                        />,
                    ]
                },
            },
        ],
    }

    return data
}
